#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#include <stack>
#include <bitset>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
void solve()
{
	int n,k;
	string s;
	cin>>n>>k>>s;
	vector<int> a;
	vector<int> b;
	if(k%2)
	{
		for(int i=0;i<n;i++)
	   {
	        if(i%2==0) a.push_back(s[i]-'a');
	        else b.push_back(s[i]-'a');
	   }
	   sort(a.begin(),a.end());
	   sort(b.begin(),b.end());
	   for(int i=0;i<n;i++)
	   {
	   	   if(i%2==0) cout<<char(a[i/2]+'a');
	   	   else cout<<char(b[i/2]+'a');
	   }
	}
	else
	{
		for(int i=0;i<n;i++)
	   {
	        a.push_back(s[i]-'a');
	   }
	   sort(a.begin(),a.end());
	   for(int i=0;i<n;i++)
	   {
	        cout<<char(a[i]+'a');
	   }
	}
	cout<<endl;
}
int main()
{
	IOS;
	int T=1;
	cin>>T;

	while(T--)
	{
		solve();
	}

	return 0;
}

